"""add_actual_risk_extend_prr_columns

Revision ID: 7a5d0e6d89f2
Revises: 01f37be65c4a
Create Date: 2025-08-12 22:52:28.448275

"""
from typing import Sequence, Union

from alembic import op
import sqlalchemy as sa


# revision identifiers, used by Alembic.
revision: str = '7a5d0e6d89f2'
down_revision: Union[str, None] = '01f37be65c4a'
branch_labels: Union[str, Sequence[str], None] = None
depends_on: Union[str, Sequence[str], None] = None


def upgrade() -> None:
    """Upgrade schema."""
    # Add actual_risk column to trades table (实际风险 = 最大浮亏点/止损点位)
    op.add_column('trades', sa.Column('actual_risk', sa.Float(), nullable=True))
    
    # Add extend column to trades table (后续最大盈利，用户输入)
    op.add_column('trades', sa.Column('extend', sa.Float(), nullable=True))
    
    # Add prr column to trades table (潜在盈亏比 = 后续最大盈利/止损点位)
    op.add_column('trades', sa.Column('prr', sa.Float(), nullable=True))


def downgrade() -> None:
    """Downgrade schema."""
    # Remove the added columns
    op.drop_column('trades', 'prr')
    op.drop_column('trades', 'extend')
    op.drop_column('trades', 'actual_risk')
